<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>表单</title>
    <link rel="stylesheet" href="__STATIC__/frame/layui/css/layui.css">
    <link rel="stylesheet" href="__STATIC__/frame/static/css/style.css">
    <link rel="icon" href="__STATIC__/frame/static/image/code.png">
    <link rel="stylesheet" href="__STATIC__/css/maowenke.css">
</head>
<body class="body">
<form class="layui-form" action="" id="form">
    <div class="layui-form-item">
        <label class="layui-form-label">vip名称</label>
        <div class="layui-input-block">
            <input type="text" name="vip_name" lay-verify="title" autocomplete="off" placeholder="请输入分类名称" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">vip等级</label>
        <div class="layui-input-block">
            <input type="number" name="vip_icon" lay-verify="title" autocomplete="off" placeholder="请输入分类名称" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">vip价格</label>
        <div class="layui-input-block">
            <input type="text" name="vip_price" lay-verify="title" autocomplete="off" placeholder="请输入分类名称" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">vip时长</label>
        <div class="layui-input-block">
           <select name="vip_time">
               <option value="2592000">一个月</option>
               <option value="15811200">半年</option>
               <option value="31536000">一年</option>
               <option value="315360000">十年</option>
           </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">vip标识</label>
        <div class="layui-input-block">
            <div class="file">
                <input type="file" name="vip_picture">点击预览
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">vip标识</label>
        <div class="layui-input-block">
            <div class="show">

            </div>
        </div>
    </div>
</form>
<div style="text-align: center">
    <button class="layui-btn" id="tijiao">提交</button>
</div>
<script src="__STATIC__/frame/layui/layui.all.js" charset="utf-8"></script>
<script src="__STATIC__/js/jquery.3.3.1.min.js" charset="utf-8"></script>
<script src="__STATIC__/js/maowenke.js" charset="utf-8"></script>
<script>
    $("[name=vip_picture]").change(function () {
        showImages($("[name=vip_picture]"),$(".show"),'100');
    });
$("#tijiao").click(function () {
    ajaxs($("#form"),"{:url('add/vip_price')}",function (data) {
        console.log(data);
        if(data.code==200){
            layer.msg(data.msg);
            setTimeout(function () {
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            },1500);
        }else{
            layer.msg(data.msg);
        }
    });
//    $.post("{:url('add/vip_price')}",{vip_name:$vip_name,vip_icon:$vip_icon,vip_price:$vip_price,vip_time:$vip_time},function (data) {
//        if(data.code==200){
//           layer.msg(data.msg);
//           setTimeout(function () {
//               var index = parent.layer.getFrameIndex(window.name);
//               parent.layer.close(index);
//           },1500);
//        }else{
//            layer.msg(data.msg);
//        }
//    })
})
</script>
</body>
</html>